From 30761439f6fb2800a6d26a91ba621117aeaa1381 Mon Sep 17 00:00:00 2001
From: Chanaka Jayasena <chanaka3d@gmail.com>
Date: Fri, 17 Jan 2014 21:08:16 +0530
Subject: [PATCH 9/9] Adding 404 page and adding one field to policy page

---
 .../console/asset.jag                              |    5 ++
 .../console/config/acl.json                        |    4 +-
 .../console/permission-mapping.txt                 |   19 ++++++
 .../console/themes/theme1/pages/plain.hbs          |   67 ++++++++++++++++++++
 .../console/themes/theme1/partials/404.hbs         |   31 +++++++++
 .../console/themes/theme1/partials/header.hbs      |    7 +--
 .../themes/theme1/partials/policy_deployments.hbs  |   15 ++++-
 .../console/themes/theme1/renderers/asset.js       |   38 +++++++++++
 8 files changed, 177 insertions(+), 9 deletions(-)
 create mode 100644 components/org.apache.stratos.manager.console/console/asset.jag
 create mode 100644 components/org.apache.stratos.manager.console/console/permission-mapping.txt
 create mode 100644 components/org.apache.stratos.manager.console/console/themes/theme1/pages/plain.hbs
 create mode 100644 components/org.apache.stratos.manager.console/console/themes/theme1/partials/404.hbs
 create mode 100644 components/org.apache.stratos.manager.console/console/themes/theme1/renderers/asset.js

diff --git a/components/org.apache.stratos.manager.console/console/asset.jag b/components/org.apache.stratos.manager.console/console/asset.jag
new file mode 100644
index 0000000..f222473
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/asset.jag
@@ -0,0 +1,5 @@
+<%
+var caramel = require('caramel')
+caramel.render({
+});
+%>
\ No newline at end of file
diff --git a/components/org.apache.stratos.manager.console/console/config/acl.json b/components/org.apache.stratos.manager.console/console/config/acl.json
index 8b4b6c2..5422611 100644
--- a/components/org.apache.stratos.manager.console/console/config/acl.json
+++ b/components/org.apache.stratos.manager.console/console/config/acl.json
@@ -1,10 +1,10 @@
 {
     "carbonsuper": {
-        "admin": ["view", "edit", "add", "tenant-edit"],
+        "admin": ["view", "edit", "subscribe","configure","tenant-mgt", "tenant-edit"],
         "Internal/Everyone": ["view", "tenant-edit"]
     },
     "tenants": {
-        "admin": ["view", "post"],
+        "admin": ["view","subscribe", "post"],
         "Internal/Everyone": ["test1","test2","view"]
     }
 }
\ No newline at end of file
diff --git a/components/org.apache.stratos.manager.console/console/permission-mapping.txt b/components/org.apache.stratos.manager.console/console/permission-mapping.txt
new file mode 100644
index 0000000..c56f6cd
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/permission-mapping.txt
@@ -0,0 +1,19 @@
+View subscribed cartridges - view
+View cartridges - view
+
+Subscribe to cartridges - subscribe
+
+Partition Deploy - configure
+View Partitions - configure
+Policy Deployments - configure
+View Deployments - configure
+LBs Deployments - configure
+View Deployments - configure
+Cartridge Deployments - configure
+View Cartridges - configure
+Multi-Tenant Service Deployments - configure
+View MT Service Deployments - configure
+
+View Tenants - tenant-mgt
+
+Configure Stratos Wizard - configure
\ No newline at end of file
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme1/pages/plain.hbs b/components/org.apache.stratos.manager.console/console/themes/theme1/pages/plain.hbs
new file mode 100644
index 0000000..b33b1d0
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme1/pages/plain.hbs
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<!--[if lt IE 7]>
+<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]>
+<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]>
+<html class="no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js"> <!--<![endif]-->
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    {{include title}}
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width">
+    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>
+    <link href="{{url "/themes/theme1/ui/css/bootstrap.css"}}" rel="stylesheet">
+    <link href="{{url "/themes/theme1/ui/css/bootstrap-theme.css"}}" rel="stylesheet">
+    <link href="{{url "/themes/theme1/ui/css/bootstrap-missing.css"}}" rel="stylesheet">
+    <link href="{{url "/themes/theme1/ui/css/main.css"}}" rel="stylesheet">
+
+</head>
+<body>
+
+<div id="dcontainer"></div>
+
+<!--[if lt IE 7]>
+<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
+    your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to
+    improve your experience.</p>
+<![endif]-->
+
+
+<!-- Part 1: Wrap all page content here -->
+<div id="wrap">
+
+    {{include body}}
+
+
+    <!-- /container -->
+    <div id="push"></div>
+</div>
+
+<footer id="footer">
+    <div class="container">
+        <div class="pull-left"><img src="{{url "/themes/theme1/ui/img/egg-logo.png"}}" /></div>
+        <div class="pull-right footer-right">
+        Copyright © 2013 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
+        Apache SIS, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.
+        </div>
+        <div style="clear:both"></div>
+    </div>
+</footer>
+
+
+
+<script src="{{url "/themes/theme1/ui/js/vendor/bootstrap.min.js"}}"></script>
+<script src="{{url "/themes/theme1/ui/js/vendor/jquery.validate.min.js"}}"></script>
+<script src="{{url "/themes/theme1/ui/js/main.js"}}"></script>
+<div class="speech-bubble help-section" id="speech_bubble_container" style="display: none">
+    <div class="speech-pointer"></div>
+    <i class="icon-help"></i>
+
+    <p></p>
+</div>
+</body>
+</html>
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme1/partials/404.hbs b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/404.hbs
new file mode 100644
index 0000000..19d4c06
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/404.hbs
@@ -0,0 +1,31 @@
+<div class="top-blue-strip"></div>
+<style>
+body {
+    padding-top: 0;
+    padding-bottom: 0;
+}
+</style>
+
+
+<div class="container">
+    <div class="row">
+        <div class="col-lg-12">
+            <a style="margin-top: 20px;display: inline-block"  href="{{url "/"}}"><img src="{{url "/themes/theme1/ui/img/logo-login.png"}}"/></a>
+
+            <h1>OOPS!</h1>
+        </div>
+    </div>
+</div>
+<div class="container">
+    <div class="row">
+        <div class="col-lg-12">
+            <div class="h2-wrapper"><h2>We are really sorry but the page you requested cannot be found.</h2></div>
+        </div>
+    </div>
+    <div class="row">
+
+        <div class="col-md-12">
+            It seems that the a page you were trying to reach doesn't exist anymore, or maybe it has just moved. We think that the best thing to do is to start again from the <a  href="{{url "/"}}">home page</a>. Feel free to contact us if the problem persist or if you definitely can't find what you are looking for. Thank you very much.
+        </div>
+    </div>
+</div>
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme1/partials/header.hbs b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/header.hbs
index 23f5082..eea3ce2 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme1/partials/header.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/header.hbs
@@ -16,18 +16,13 @@
         <div class="container">
             <div class="row">
                 <div class="col-lg-3">
-                    {{#ifAllowed "tenant-mgt"}}
-                        can tenant-mgt
-                    {{else}}
-                        can't tenant-mgt
-                    {{/ifAllowed}}
                     <a class="navbar-brand" href="{{url "/"}}"><img src="{{url "/themes/theme1/ui/img/logo-inside.png"}}"/></a>
                  </div>
                  <div class="col-lg-9 custom-nav">
                     <ul class="pull-left">
                         <!-- li {{#if dashboard}} class="active" {{/if}}><a href="{{url "/"}}"><i class="fa fa-dashboard"></i> <span><br>Dashboard</span></a></li -->
                         <li {{#if my_cartridges}} class="active" {{/if}}><a href="{{url "/"}}"><i class="fa fa-tasks"></i>  <span><br>My Cartridges</span></a></li>
-                        {{#isAllowed "edit"}}<li {{#if configure_stratos}} class="active" {{/if}}><a href="{{url "/partition_deployments.jag"}}"><i class="fa fa-cogs"></i> <span><br>Configure Stratos</span></a></li>{{/isAllowed}}
+                        {{#isAllowed "configure"}}<li {{#if configure_stratos}} class="active" {{/if}}><a href="{{url "/partition_deployments.jag"}}"><i class="fa fa-cogs"></i> <span><br>Configure Stratos</span></a></li>{{/isAllowed}}
                         {{#isAllowed "tenant-mgt"}}<li {{#if tenant_mgt}} class="active" {{/if}}><a href="{{url "/tenant_management.jag"}}"><i class="fa fa-user"></i> <span><br>Tenant Mgt</span></a></li>{{/isAllowed}}
                      </ul>
                      <ul class="pull-right">
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme1/partials/policy_deployments.hbs b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/policy_deployments.hbs
index f688477..e70039a 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme1/partials/policy_deployments.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme1/partials/policy_deployments.hbs
@@ -10,11 +10,24 @@
         <div class="col-md-12">
             <h2>Deploy New Policy</h2>
             <form method="post" role="form" action="{{url "/controllers/partitionDefintionSubmit.jag"}}">
-            <label for="policy" class="required">Policy Configuration</label>
+
 
             <div class="container">
                 <div class="row">
                     <div class="col-md-6 padding-remover-left">
+                        <label class="required">Policy Type</label>
+
+                        <div class="form-inline" style="padding-bottom: 10px;">
+                            <div class="radio">
+                                <label style="padding-right: 20px;">
+                                    <input name="policyType" type="radio" checked="checked"> Auto scale
+                                </label>
+                                <label>
+                                    <input name="policyType" type="radio"> Deployment
+                                </label>
+                            </div>
+                        </div>
+                        <label for="policy" class="required">Policy Configuration</label>
                         <textarea name="policy-definition" class="form-control" rows="11" id="policy"></textarea>
                         <button type="submit" class="btn btn-primary" id="deployPolicy">Deploy Partition</button>
                         <a>Cancel</a>
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme1/renderers/asset.js b/components/org.apache.stratos.manager.console/console/themes/theme1/renderers/asset.js
new file mode 100644
index 0000000..3aaf2c7
--- /dev/null
+++ b/components/org.apache.stratos.manager.console/console/themes/theme1/renderers/asset.js
@@ -0,0 +1,38 @@
+var render = function (theme, data, meta, require) {
+      // Re-create the data structure of the cartridges.
+
+    theme('plain', {
+        body: [
+            {
+                partial: '404',
+                context: {
+                    title: 'My Cartridges'
+                }
+            }
+        ],
+        header: [
+            {
+                partial: 'header',
+                context: {
+                    title: 'My Cartridges',
+                    my_cartridges: true,
+                    button: {
+                        link: '/cartridges.jag',
+                        name: 'Subscribe to Cartridge',
+                        class_name: 'btn-important'
+                    },
+                    has_help: true,
+                    help: 'Create cartridges like PHP, Python, Ruby etc.. Or create data cartridges with mySql, PostgreSQL. Directly install applications like Drupal, Wordpress etc..'
+                }
+            }
+        ],
+        title: [
+            {
+                partial: 'title',
+                context: {
+                    title: "My Cartridges"
+                }
+            }
+        ]
+    });
+};
\ No newline at end of file
-- 
1.7.9.msysgit.0

